# coding=utf8

import sys
import os
import re
__author__ = "zouxiaoliang"

if __name__ == '__main__':
    logs_path = sys.argv[1]
    if not os.path.exists(logs_path):
        exit(1)

    log_set = set()

    log_file_list = os.listdir(logs_path)
    i = 0
    a = len(log_file_list)
    for log_file in log_file_list:
        fr = open(os.path.join(logs_path, log_file))
        lines = fr.readlines()
        for line in lines:
            ret = re.search("index:\[([\d])+\] total:\[[\d]+\] used:\[[\d]+\] spaces full", line)
            if ret is not None:
                # print ret.group(0)
                log_set.add(ret.group(0))
        i += 1
        print "%d/%d %s" % (i, a, os.path.join(logs_path, log_file))

    for x in log_set:
        print x
